home *** CD-ROM | disk | FTP | other *** search
- *** orig/make-3.71/main.c Thu Jul 21 01:30:06 1994
- --- src/make-3.71/main.c Thu Jul 21 02:16:02 1994
- ***************
- *** 316,321 ****
- --- 316,325 ----
-
- char *starting_directory;
-
- + /* Our current directory before processing any -C options. */
- +
- + char *directory_before_chdir;
- +
- /* Value of the MAKELEVEL variable at startup (or 0). */
-
- unsigned int makelevel;
- ***************
- *** 394,400 ****
- register struct dep *lastgoal;
- struct dep *read_makefiles;
- PATH_VAR (current_directory);
- - char *directory_before_chdir;
-
- default_goal_file = 0;
- reading_filename = 0;
- --- 398,403 ----
- ***************
- *** 464,469 ****
- --- 467,478 ----
- else
- {
- program = rindex (argv[0], '/');
- + #ifdef __MSDOS__
- + if (program == 0)
- + program = rindex (argv[0], '\\');
- + if (program == 0)
- + program = rindex (argv[0], ':');
- + #endif
- if (program == 0)
- program = argv[0];
- else
- ***************
- *** 601,606 ****
- --- 610,616 ----
- }
- free (cmd_defs);
-
- + #ifndef __MSDOS__
- /* Set the "MAKE_COMMAND" variable to the name we were invoked with.
- (If it is a relative pathname with a slash, prepend our directory name
- so the result will run the same program regardless of the current dir.
- ***************
- *** 610,615 ****
- --- 620,626 ----
- if (current_directory[0] != '\0'
- && argv[0] != 0 && argv[0][0] != '/' && index (argv[0], '/') != 0)
- argv[0] = concat (current_directory, "/", argv[0]);
- + #endif /* __MSDOS__ */
-
- (void) define_variable ("MAKE_COMMAND", 12, argv[0], o_default, 0);
-
- ***************
- *** 1752,1757 ****
- --- 1763,1777 ----
- if (!dying)
- {
- int err;
- +
- + /* On some systems, especially MS-DOS, the current directory is a
- + system value, not a per-process value, so we must restore our
- + original directory or we find ourselves in some other directory
- + after make finishes. On unix, this doesn't hurt, and will make
- + sure the core file is in the "expected" place if we core dump
- + on exit */
- + if (directory_before_chdir)
- + chdir (directory_before_chdir);
-
- dying = 1;
-
-